package com.yoda.controller;


import com.yoda.dto.AdvImgDto;
import com.yoda.dto.AdvImgPageQuery;
import com.yoda.entity.YddAdvimg;
import com.yoda.result.Result;
import com.yoda.service.IYddAdvimgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author itcast
 * @since 2023-05-15
 */
@RestController
@RequestMapping("/ydd_advimg")
public class YddAdvimgController {
    @Autowired
    private IYddAdvimgService service;


    /**
     * 广告图详情
     * @param id
     * @return
     */
    @GetMapping("/rowInfo")
    public Result selectById(String id) {
        return service.selectById(id);
    }

    /**
     * 广告图列表-分页
     * @param adv
     * @return
     */
    @GetMapping("/list")
    public Result pageQuery(AdvImgPageQuery adv) {
        return service.pageQuery(adv);
    }

    /**
     * 广告图修改
     * @param dto
     * @return
     */
    @PostMapping("/update")
    public Result updateAdvImage(@RequestBody AdvImgDto dto) {
        return service.updateAdvImage(dto);
    }

    /**
     * 根据id进行广告图删除
     * @param id
     * @return
     */
    @GetMapping("/del")
    public Result deleteById(String id){
        return service.deleteById(id);
    }

    /**
     * 广告图添加
     * @param advimg
     * @return
     */
    @PostMapping("/add")
    public Result addAdvImg(@RequestBody YddAdvimg advimg){
        return service.addAdvImg(advimg);
    }

}

